<%@ taglib prefix="c" uri="jakarta.tags.core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <base href="<%=request.getContextPath()%>/">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>新增医生</title>
    <link rel="stylesheet" href="statics/css/hisStyle.css">
    <link rel="stylesheet" href="statics/css/common-styles.css">
</head>
<body>
<%@include file="../common/sidebar.jsp"%>
<div class="main-content">
    <%@include file="../common/top.jsp"%>
    <div class="content">
        <div class="function-page">
            <!-- 页面标题 -->
            <div class="page-header">
                <h1>新增医生</h1>
            </div>

            <!-- 错误提示 -->
            <c:if test="${not empty error}">
                <div class="message-error">
                    ${error}
                </div>
            </c:if>

            <form action="doctor/add" method="post" class="form-container">
                <div class="form-group">
                    <label for="doctorName">医生姓名：</label>
                    <input type="text" id="doctorName" name="doctorName" value="${doctor.doctorName}" class="form-control" required>
                </div>
                <div class="form-group">
                    <label for="gender">性别：</label>
                    <select id="gender" name="gender" class="form-control" required>
                        <option value="男" <c:if test="${doctor.gender eq '男'}">selected</c:if>>男</option>
                        <option value="女" <c:if test="${doctor.gender eq '女'}">selected</c:if>>女</option>
                    </select>
                </div>
                <div class="form-group">
                    <label for="phone">电话：</label>
                    <input type="tel" id="phone" name="phone" value="${doctor.phone}" class="form-control" required>
                </div>
                <div class="form-group">
                    <label for="email">邮箱：</label>
                    <input type="email" id="email" name="email" value="${doctor.email}" class="form-control">
                </div>
                <div class="form-group">
                    <label for="idCard">身份证号：</label>
                    <input type="text" id="idCard" name="idCard" value="${doctor.idCard}" class="form-control" required>
                </div>
                <div class="form-group">
                    <label for="headPic">头像：</label>
                    <input type="text" id="headPic" name="headPic" value="${doctor.headPic}" class="form-control">
                </div>
                <div class="form-group">
                    <label for="hospitalId">所属医院：</label>
                    <select id="hospitalId" name="hospitalId" class="form-control" required>
                        <option value="">--请选择医院--</option>
                        <c:forEach items="${hospitalList}" var="hospital">
                            <option value="${hospital.hospitalId}">${hospital.hospitalName}</option>
                        </c:forEach>
                    </select>
                </div>
                <div class="form-group">
                    <label for="deptId">所属科室：</label>
                    <select id="deptId" name="deptId" class="form-control" required>
                        <option value="">--请选择科室--</option>
                        <c:forEach items="${departmentList}" var="dept">
                            <option value="${dept.deptId}">${dept.deptName}</option>
                        </c:forEach>
                    </select>
                </div>
                <div class="form-actions">
                    <a href="doctor/find" class="btn btn-default">取消</a>
                    <button type="submit" class="btn btn-primary">保存</button>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
</html>